var $=function(node){
return document.getElementById(node);
}
function $(objId){
return document.getElementById(objId);
}

function dk(){
var obj = $("ww");
var index = obj.selectedIndex;
var av = obj.options[index].value;
return av;
}

function inst() {
var tx = dk(); //选中值
if ($("name")!=null) $("name").value = "请输入"+tx;
if ($("name")!=null) $("name").setAttribute("placeholder","请输入"+tx);
if ($("tishi1")!=null) $("tishi1").innerHTML = "请输入"+tx;
}

function sa(ids,Num){
var tx = dk(); //选中值
if ($(ids).value == "请输入"+tx || $(ids).value.indexOf("请输入") == 0){
$(ids).value = "";
}
}

function shaw(boxs,bl){
var gu = $("o"+boxs).innerHTML;
 var uy = $("n"+boxs).innerHTML;
var lo = gu.substring(0,36) + "...(可展开)<!--hide-->"; //自己调整
if(bl == "r"){
 $("n"+boxs).innerHTML = gu;
}else if(bl == "s"){
 $("n"+boxs).innerHTML = lo;
}else{
if(uy.indexOf("<!--hide-->") != -1){
 shaw(boxs,'r');
}else{
 shaw(boxs,'s');
}
}
}

//过滤文本左右两端的空格
function GetRequest(Url,act,GetFunction){
if(window.ActiveXObject){
var xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}else{
var xmlHttpRequest = new XMLHttpRequest();
}
xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4){
if(xmlHttpRequest.status == 200){
GetFunction(xmlHttpRequest.responseText);
}else{
GetFunction(404);
}
}
}
xmlHttpRequest.open("post",'?Act='+act+"&t="+Math.random(),true);
xmlHttpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttpRequest.send(Url);
}
function eq(act,oa) {
SendUrl = "Act="+act;
if(oa==""){oa="|";}
rs=oa.split("|");
for(eg=0; eg<rs.length; eg++) {
ji = rs[eg];
if(ji!=""){
if($(ji)==null){alert("未提交:"+ji+"元素不存在!");return false;}
if($(ji).value==""){alert("未提交:请填写"+ji+"参数!");return false;}
SendUrl += "&"+ji+"="+ encodeURIComponent($(ji).value);
}
}
GetRequest(SendUrl,act,function(GetText){
if(GetText == 404){
alert("通讯失败:"+SendUrl);return false;
}else{
if(GetText.indexOf('<table')!=-1){
$('wt').innerHTML=GetText;
}else if(GetText=="ok.chalide.cn"){
alert(act+"操作成功");
 sp();
}else{
alert(GetText);
}
}
});
}
function sp() {
var Pag = $("page").value;
chalide("2",Pag);
}
function bi() {
if (window.confirm("确定要清空嘛（本页字段别名需要全部重新填写）？")==true){
eq('xb','xb|');
}
}
function chalide(Num,Pag) {
var tx = dk(); //选中值
if ($("name")!=null) $("name").setAttribute("placeholder","请输入"+tx);
if ($("tishi1")!=null) $("tishi1").innerHTML = "请输入"+tx;
if ($("page")!=null) $("page").value = Pag;
if(Num == 2 || Num == 0){
eq("cha","ww|name|page|soso");
}
}